import api from '../api'
import axios from '../utils/axios'


// 查询客户概况所有总数接口
function customerStateAll() {
    return new Promise((reslove,reject) => {
        console.log("进来了");
        axios({
            url:api.dataAnalysisApi.CUSTOMER_STATEAll,
            method:"post"
        }).then((res) => {
            // console.log(res);
            reslove(res.data)
        }).catch(err => {
            // console.log(err);
            reject(err)
        })
    })
}
// 查询客户今日所有总数接口
function customerStateToday() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.CUSTOMER_STATEAllTODAY,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 查询客户概况一周总数总数接口
function customerStateWeek() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.CUSTOMER_STATEAllWEEk,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 查询客户概况一月总数总数接口
function customerStateMonth() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.CUSTOMER_STATEAllMONTH,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 跟单统计员工所有曲线
function allOrderByStaff() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.ALLORDER_BYSTAFF,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 跟单统计30天员工所有曲线
function monthOrderByStaff() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.MONTHORDER_BYSTAFFMONTH,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 跟单统计7天员工所有曲线
function weekOrderByStaff() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.WEEKORDER_BYSTAFFMONTH,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 跟单统计部门所有曲线
function allOrderByDepart() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.ALLORDER_BYDEPART,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 跟单统计30部门所有曲线
function monthOrderByDepart() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.MONTHORDER_BYDEPART,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 跟单统计7部门所有曲线
function weekOrderByDepart() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.WEEKORDER_BYDEPART,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 售后年度曲线
function afterSaleAnnualCurve() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.ANNUALCUR_AFTERSALES,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 合同年度曲线
function contractAnnualCurve() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.ANNUALCUR_CONTRACT,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 客户年度曲线
function coustomerAnnualCurve() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.ANNUALCUR_COUSTOMER,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 跟单年度曲线
function gendanAnnualCurve() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.ANNUALCUR_GENGDAN,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
// 订单年度曲线
function orderAnnualCurve() {
    return new Promise((reslove, reject) => {
        axios({
            url:api.dataAnalysisApi.ANNUALCUR_ORDER,
            method:"post"
        }).then((res) => {
            reslove(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}


const dataService = {
    customerStateAll,    // 查询客户概况接口
    customerStateToday,
    customerStateWeek,
    customerStateMonth,
    allOrderByStaff,
    monthOrderByStaff,
    weekOrderByStaff,
    allOrderByDepart,
    monthOrderByDepart,
    weekOrderByDepart,
    afterSaleAnnualCurve,
    contractAnnualCurve,
    coustomerAnnualCurve,
    gendanAnnualCurve,
    orderAnnualCurve
}

export default dataService